package praktikumid.p02_k;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author ago
 *
 */
public class InputExample {
	/**
	 * @param args Arguments
	 * @throws IOException BufferedReader.readLine() needs that
	 */
	public static void main(String[] args) throws IOException {
		// how to read arguments?

		//String sona = args[0];
		System.out.println(args.length);
		for (int i = 0; i < args.length; i++) {
			System.out.println(args[i]);
		}
		System.exit(1);

		String input;
		InputStreamReader in = 
			new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(in);
		
		String[] history = new String[10];
		int historyCount = 0;
		
		// first element
		history[0] = "tere";
		System.out.println(history[0]);
		// second element
		history[1] = "tulemast";
		System.out.println(history[1]);
		
		while (true) {
			System.out.print("sisesta tekst:");
			input = br.readLine();
			
			history[historyCount] = input;
			historyCount++;
			
			//System.out.println("sain teksti: " + input);
			
			System.out.println("ajalugu:");
			for (int i = 0; i < historyCount; i++) {
				System.out.println(history[i]);
			}
			
			if (input.equalsIgnoreCase("exit")) {
				System.out.print("väljun");
				break;
			}
		}
		//System.in
	}
}